package File流;

import java.io.*;
import java.util.Arrays;

/**
 * @author chihb
 * @create-time 2024/7/5 22:01
 * @description
 */
public class Test4 {
    static int runCount;
    public static void main(String[] args) throws IOException {
        try (
                BufferedReader br=new BufferedReader(new FileReader("E:\\javaSE\\result.txt"));

                ){
            String line;
            while ((line=br.readLine())!=null){
                String[] split = line.split("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)");
                System.out.println(line);
                runCount=Integer.valueOf(split[1])+1;
            }
        }
        try (BufferedWriter bw=new BufferedWriter(new FileWriter("E:\\javaSE\\result.txt"));){
            if(runCount<4){
                bw.write("欢迎使用本软件,第"+runCount+"次使用免费~ ");
            }else {
                bw.write("本软件只能免费使用3次,欢迎您注册会员后继续使用");
            }
        }
    }
}
